﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="MvcForum.Net.Mvc.ViewPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">

<%
    var _page = ViewData["Page"] as PageEntity; %>

    <%=Html.Title("{0} - {1}", _page.Name, ForumContext.Configuration.ForumName)%>
    <%=Html.Keywords(ForumContext.GetText("WHO_IS_ONLINE", "KEYWORDS"))%>
    <%=Html.Description(ForumContext.GetText("WHO_IS_ONLINE", "DESCRIPTION"))%>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <%Html.RenderPartial("LogOn"); Html.RenderPartial("navigation"); %>
    <div class="fr-widget white-space">
        <div class="header">
            <div class="icon">
            </div>
            <span><%=ForumContext.GetText("WHO_IS_ONLINE","PAGE_NAME") %></span>
        </div>
        <table cellpadding="0" cellspacing="1" width="100%">
            <tr>
                <td class="table-header width20">
                    <%=ForumContext.GetText("WHO_IS_ONLINE", "MEMBER") %>
                </td>
                <td class="table-header width35">
                    <%=ForumContext.GetText("WHO_IS_ONLINE", "CURRENT_PAGE") %>
                </td>
                <td class="table-header width15">
                    <%=ForumContext.GetText("WHO_IS_ONLINE", "LAST_ACTION") %>
                </td>
                <td class="table-header width15">
                    <%=ForumContext.GetText("WHO_IS_ONLINE", "BROWSER") %>
                </td>
                <td class="table-header width15">
                    <%=ForumContext.GetText("WHO_IS_ONLINE", "PLATFORM")%>
                </td>
            </tr>
            <%
                var _users = ViewData["UserActions"] as List<UsersAction>;

                if (_users != null)
                {
                    foreach (var user in _users)
                    {


            %>
            <tr>
                <td class="table-cell">
                    <%
                        if (!string.IsNullOrEmpty(user.UserName))
                        {%>
                    <a href="<%=ForumContext.GetAbsoluteUrl(ForumUrls.USER_INFO,user.UserName) %>">
                        <%=Html.Encode(user.UserName)%></a>
                    <%
                        }
                        else
                        {
                    %>
                    [<a href="http://www.whois.sc/<%=user.IP%>"><%=Html.Encode(user.IP)%></a>]
                    <%

                        }%>
                </td>
                <td class="table-cell">
                    <a href="<%=user.Location%>">
                        <%=user.PageTitle%></a>
                </td>
                <td class="table-cell center">
                    <%=ForumContext.PrettyDate(Convert.ToDateTime(user.LastAction))%>
                </td>
                <td class="table-cell center">
                    <%=Html.Encode(user.Browser)%>
                </td>
                <td class="table-cell center">
                    <%=Html.Encode(user.Platform)%>
                </td>
            </tr>
            <%
}
                }%>
        </table>
    </div>


    <div class="white-space">

    <%
        var _totalRows = Convert.ToInt32(ViewData["TotalRows"]);
        var _pageIndex = Convert.ToInt32(ViewData["PageIndex"]);
        
    %>
    <%=ForumContext.PageRender(ForumContext.GetAbsoluteUrl(ForumUrls.WHO_IS_ONLINE)+"?P={0}",_pageIndex,ForumContext.Configuration.PageSize,_totalRows) %>
    </div>
    <br class="clear-all" />
    <br class="clearfix" />
    
</asp:Content>
